package pl.edu.agh.student.nn.utils;

import java.util.Random;

/**
 * Created by IntelliJ IDEA.
 * User: Krzysiek
 * Date: 12.11.11
 * Time: 00:20
 * To change this template use File | Settings | File Templates.
 */
public class InputParserUtils {
    public static double getDouble(String serializedValue) {
        if (serializedValue.contains("@")) {
            String[] range = serializedValue.split("@");
            Double from = Double.parseDouble(range[0]);
            Double to = Double.parseDouble(range[1]);
            Random rand = new Random();
            return rand.nextDouble() * (to - from) + from;
        } else
            return Double.parseDouble(serializedValue);
    }
}
